<div class="detaiTab detaiTab1 m10">
<form action="<@url value='/workflowsubmit/save_ns' />" class="action-ajax-form" method="post">

	<!-- <#if nodeCode=='NS_FKJL'   || nodeCode=='BP_NS_SQFGJL' >
		   <div class="openBox">
		   		<h3><i class="jtIco"></i>夫妻双方房产信息<a class="action-ajax-btn fr" data-action-html="#o2o_house_form" href="/house/house_list_form?loanapplyId=${loan.loanapplyNo}">&nbsp&nbsp&nbsp&nbsp刷新&nbsp&nbsp&nbsp&nbsp</a></h3>	
			   <div class="detailTab">
		             <div id="o2o_house_form"  class="action-ajax-load" data-url="/house/house_list_form?loanapplyId=${loan.loanapplyNo}" data-ajax-wait-img="<@cdn value='img.wait'/>" ></div>
			   </div> 
			</div>
			<div class="openBox">
			   <h3><i class="jtIco"></i>夫妻双方车产信息<a class="action-ajax-btn fr" data-action-html="#o2o_car_form" href="/car/car_list_form?loanapplyId=${loan.loanapplyNo}">&nbsp&nbsp&nbsp&nbsp刷新&nbsp&nbsp&nbsp&nbsp</a></h3>
			   <div class="detailTab">
		             <div id="o2o_car_form"  class="action-ajax-load" data-url="/car/car_list_form?loanapplyId=${loan.loanapplyNo}" data-ajax-wait-img="<@cdn value='img.wait'/>" ></div>
			   </div> 
		    </div>
		     <div class="openBox">
			   <h3><i class="jtIco"></i>夫妻双方其他资产信息<a class="action-ajax-btn fr" data-action-html="#o2o_other_form" href="/other_assets/other_assets_list_form?loanapplyId=${loan.loanapplyNo}">&nbsp&nbsp&nbsp&nbsp刷新&nbsp&nbsp&nbsp&nbsp</a></h3>
			   <div class="detailTab">
		             <div id="o2o_other_form"  class="action-ajax-load" data-url="/other_assets/other_assets_list_form?loanapplyId=${loan.loanapplyNo}" data-ajax-wait-img="<@cdn value='img.wait'/>" ></div>
			   </div> 
		  </div>   
	</#if> -->

     <p class="p10 ">我的审批意见
     <#if nodeCode=='BM_NSZBCS' || nodeCode=='BM_NSZBFS' || nodeCode=='BP_NS_ZBFXJL' || nodeCode=='BP_NS_ZBFXZJ'>
					<a class="action-ajax-btn btn_auto_30 btn_yellow ml20" href="<@url value='/rbadloan/cacle?loanapplyNo=${loan.loanapplyNo}&tType=VETO'/>">否决</a>
					</#if></p>
    <div class="detaiTab b_t">
     <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tbody>
           <tr>
         	  <td align="right" width="18%" class="bg fontW"><span class=" fs14"><span style="color:red;">*</span>综合费率（年化）:</span></td>
                  <td width="35%">
                  <span class="fs14">
                  <#if nodeCode=='NS_XDJL' || nodeCode=='NS_ZJL' || nodeCode=='NS_FKJL' ||  nodeCode=='NS_QYJLSPR' >
                  <@select class="fontW" dataSouceType="GENALRATE" value="0.15" renderonly="true"/>
                   <input type="hidden" id="generalRate" name="generalRate"  value="${loan.generalRate}"/>
                  <#else>
                  <@select id="generalRate" onchange="onGeneralSelect()" class="fontW" 
                   dataSouceType="GENALRATE" name="generalRate" value="${loan.generalRate}"/>
                 </#if>
                   </span>
				 <span id="error" style="color:red;visibility:visible;"></span>
				 </td>
           		<td align="right" class="bg" width="18%"><span style="color:red;">*</span>贷款期限:</td>
           		<td><span class="fs14">
           	 	<@select id="loanTerm" dataSouceType="OTOLOANTERM" name="loanTerm" value="${loan.loanTerm}"/></span>
		   		</td>
				<input id="loanapplyNo" type="hidden" name="loanapplyNo" value="${loan.loanapplyNo}"/>
				<input  type="hidden" name="nodeCode" value="${nodeCode}"/>
            </tr>
            
            <tr>	
              <td align="right" class="bg"><span class=" fs14"><span style="color:red;">*</span>贷款利率（年化）:</span></td>
                <td><span class=" fs14" id="loanrate">${(loan.loanrate*100)?string("0.0000")}%年</span>
                	<input type="hidden" value="${loan.loanrate}" id="loanRate" name="loanrate"/>
                </td>
               <td align="right" class="bg"><span class=" fs14"><span style="color:red;">*</span>还款方式:</span></td>
               <td><span class="fs14"><@select id="repayMentway" dataSouceType="OTOREPAYMENTWAY" name="repayMentway" value="${loan.repayMentway}"/></span></td>
			 </tr>
			 
             <tr>	
                 <td align="right" class="bg"><span class=" fs14"><span style="color:red;">*</span>管理费率（年化）:</span></td>
                 <td><span class="fs14">
                  <#if nodeCode=='NS_XDJL' || nodeCode=='NS_ZJL' || nodeCode=='NS_FKJL'>
                  <@select dataSouceType="O2OMANAGEFEERATE"  value="${loan.managefeerate}" 
                  onchange="onMangerSelect()" renderonly="true"/>
                   <input type="hidden" name="managefeerate" id="manger" value="${loan.managefeerate}"/>
                  <#else>
                 <@select id="manger" dataSouceType="O2OMANAGEFEERATE" name="managefeerate" 
                 value="${loan.managefeerate}" onchange="onMangerSelect()"/>
                 </#if>
                 </span>
                 <span id="mangerError" style="color:red;visibility:visible;"></span>
				 </td>
                  <td align="right" class="bg"><span class=" fs14"><span style="color:red;">*</span>保证金费率（年化）:</span></td>
                  <td><span class="fs14">
                  <#if nodeCode=='NS_XDJL' || nodeCode=='NS_ZJL' || nodeCode=='NS_FKJL'>
                      <@select  dataSouceType="O2ODEPOSITFEERATE" value="${loan.depositrate}" renderonly="true"/>
                   <input type="hidden" id="desposit" name="depositrate" value="${loan.depositrate}"/>
                  <#else>
                   <@select id="desposit" dataSouceType="O2ODEPOSITFEERATE" name="depositrate" 
                 value="${loan.depositrate}"/>
                 </#if>
                 </span>
					</td>
              </tr>
              
              <tr>	
                <td align="right" class="bg"><span class=" fs14"><span style="color:red;">*</span>风险补偿金（年化）:</span></td>
                 <td>
                 <span class="fs14" id="expandRisk"></span>
                 <input type="hidden" name="risk" value="${expand.risk}" id="risk"/>
				 </td>
				  <td align="right" class="bg" width="15%"><span style="color:red;">*</span>EA批复额度:</td>  
				  <td>
				    <input id="eaMount" type="text" name="eaMount" class="tabInp inputNum action-valid-field" value="${loan.eaMount}"/>
				  </td>
              </tr>
              
              <tr>	
                <td align="right" class="bg"><span class=" fs14"><span style="color:red;">*</span>贷款用途:</span></td>
                 <td>
                 <span class="fs14"><@select id="paymentType" dataSouceType="PAYMENTTYPE" name="paymentType" 
                 value="${loan.paymentType}"/></span>
				 </td>
				  <td align="right" class="bg" width="15%"><span style="color:red;">*</span>送审银行:</td>  
				  <td>
				 <#if (loan.bankLoanName)??>
				   <span class="fs14"><@select dataSouceType="BANKTYPEO2O_SB" name="bankLoanName"
							onchange="onBankSelect()" id="bankLoanName"
							value="${loan.bankLoanName}"/></span>
							<span id="bankError" style="color:red;visibility:visible;"></span>
				 	<#else>
				 	  <span class="fs14"><@select dataSouceType="BANKTYPEO2O_SB" name="bankLoanName"
							onchange="onBankSelect()" id="bankLoanName"
							value="${loan.bankType}"/></span>
							<span id="bankError" style="color:red;visibility:visible;"></span>
				 </#if>
				  </td>
              </tr>
              <!--
              <#if nodeCode=='NS_XDJL'>
               <tr>	
                <td align="right" class="bg" title="如果该笔贷款由合资公司提供担保，则选择相对应的经办平台作为回购担保方，如果该笔贷款合资公司不提供担保，则选择O2O金融中心作为回购担保方"><span style="color:red;">*</span>回购担保方<span class=" wenhaoIco">:</span></td>
                 <td colspan="3">
                 <span class="fs14">${loan.buybackName}
                 	<input type="text" name="buybackName" value="${loan.buybackName}" class="btn_auto_30 btn_blue bn" readonly="readonly" />
                 	<input type="hidden" name="buybackId" value="${loan.buybackId}" class="btn_auto_30 btn_blue bn" />
				 </td>
				 <td width="15%" align="right" class="bg"  title="1、自营模式：贷款由380金服平台自行获客，并由380金服平台对合作银行提供回购担保； 2、共享模式：贷款由各经办机构推荐获客，并由经办机构对合作银行提供回购担保； 3、推荐模式：贷款由各经办机构推荐获客，由380金服平台对合作银行提供回购担保，续贷不计入佣金模式，计入自营模式。">经营模式<span class=" wenhaoIco"></span>:</td>
								<td colspan="3" ><@select dataSouceType="OPERATION_MODEL"
									name="operationModel" onchange="chechkSelect('operationModel');"
									id="operationModel" value="${loanApplyFileEntity.operationModel}"
									class="tabInp action-valid-field" /> <span
									id="operationModel_ERROR" style="color: red;"></span>
			    </td>
              </tr>
              </#if>
              -->
              <tr>
					<td class="bg" align="right">备注:</td>
					<td colspan="3">
					<textarea rows="3" cols="100" name="remark">${expand.remark}</textarea>
					</td>
			  </tr>
              <tr>
					<td class="bg" align="right">操作:</td>
					<td colspan="3">
					<input type="submit" value="保存" class="btn_auto_30 btn_blue" /><span class="red fs14 ml10">(请确认本次贷款经营模式是否正确)(如需修改利率，请在利率变更理由栏目详述理由并保存，且需提前报备总部)</span>
					
					</td>
			  </tr>
			  <!--
			  <tr>
				<td class="bg" align="right"></td>
					<td>
						<a href="<@url value='/payment/upload?referId=${loan.loanapplyNo}'/>" target="_blank">补充附件</a>
					</td>
				</tr>
				-->
         	   <tr>
				<td class="bg" align="right">保证金:</td><td colspan="3">保证金=EA批复额度*费率</td>
				</tr>
				<tr>
				<td class="bg" align="right">管理费:</td><td colspan="3">管理费=(EA批复额度*年化费率*贷款月数)/12,贷款月数(小于等于6个月，按6个月收取，大于6个月，按实际月份收取)</td>
				</tr>
				<tr>
				<td class="bg" align="right">风险补偿金:</td><td colspan="3">风险补偿金=(EA批复额度*年化费率**贷款月数)/12，贷款月数(小于等于6个月，按6个月收取，大于6个月小于等于12个月，按12个月收取)</td>
				</tr>
          </tbody>
       </table>  
   </div>
   </form>
   <#if nodeCode=='NS_XDJL' || nodeCode =='BP_NS_PTXDJL' >
   <div class="detaiTab detaiTab1 m10">
 	<p class="p10">
 		上传附件
 	</p>
    <div class="detaiTab">
        <table id="myTable" width="100%" cellspacing="0" cellpadding="0" border="0" class="b_t_e5 zjfile">
              <tbody>
                <tr>
                    <td width="15%" align="right" class="bg"> </td>
                    <td width="15%" ><@fileUpload url="/loanrest/othfile/DCWD/${loan.loanapplyNo}" title="上传调查文件"/></td>
                    <td align="left" ><@fileUpload url="/loanrest/othfile/NSFJ/${loan.loanapplyNo}" title="上传内审资料"/></td>
                </tr>
              </tbody>
            </table> 
   </div> 
	</div>
   
   <div class="detaiTab detaiTab1 m10">
        <p class="p10">调查文档信息</p>
       <div class="dataBable"><@pagination paginationInfo="pageResult"/></div>
  </div>
  <div class="detaiTab detaiTab1 m10">
        <p class="p10">内审资料信息</p>
       <div class="dataBable"><@pagination paginationInfo="pageResultNS"/></div>
  </div>
  </#if>
       </div>
       <@js>
	$(document).ready(function() {
		var generalRate = $("#generalRate").val();
		if (generalRate) {
			var risk = ($("#risk").val() * 100).toFixed(4) + "%";
			$("#expandRisk").html(risk);
			$("#error").html("");
			$("#error").css('visibility', 'visible');
		} else {
			$("#generalRate").val(0.15);
			onGeneralSelect();
		}
	});
	//综合费率
	function onGeneralSelect() {
		var generalRate = $("#generalRate").val();
		if (generalRate) {
			$("#error").html("");
			$("#error").css('visibility', 'hidden');
		} else {
			$("#error").html("请选择综合费率");
			$("#error").css('visibility', 'visible');
			return;
		}
		var manger = $("#manger").val() * 1;
		var loanRate = $("#loanRate").val() * 1;
		var bankLoanName = $("#bankLoanName").val();
		if (bankLoanName) {
			$("#bankError").html("");
			$("#bankError").css('visibility', 'hidden');
			if (bankLoanName == "CBC") {
				loanRate = 0.0775;
			} else if (bankLoanName == "BC") {
				loanRate = 0.065;
			} else if (bankLoanName == "GACZ") {
				loanRate = 0.065;
			} else if (bankLoanName == "CCBHN") {
				loanRate = 0.06003;
			} else if (bankLoanName == "QLB") {
				loanRate = 0.065;
			} else if (bankLoanName == "CIBJN") {
				loanRate = 0.065;
			} else if (bankLoanName == "JCB") {
				loanRate = 0.062;
			} else if (bankLoanName == "ZZB") {
				loanRate = 0.06525;
			} else if (bankLoanName == "SPDBGZ") {
				loanRate = 0.064815;
			} else if (bankLoanName == "SXB") {
				loanRate = 0.06;
			} else if (bankLoanName == "ZLB") {
				loanRate = 0.0609;
			} else if (bankLoanName == "SPDBJN") {
				loanRate = 0.06525;
			} else {
				loanRate = 0.08;
			}
		}
		var exisk = generalRate * 1 - manger - loanRate;
		if (exisk < 0) {
			$("#error").html("补偿金小于0,请修改管理费或综合费率");
			$("#error").css('visibility', 'visible');
		} else {
			$("#error").html("");
			$("#error").css('visibility', 'hidden');
			$("#mangerError").html("");
			$("#mangerError").css('visibility', 'hidden');
			$("#bankError").html("");
			$("#bankError").css('visibility', 'hidden');
		}
			$("#risk").val(exisk.toFixed(6));
			$("#expandRisk").html((exisk * 100).toFixed(4) + "%");
	}
	//管理费
	function onMangerSelect() {
		var manger = $("#manger").val();
		if (manger) {
			$("#mangerError").html("");
			$("#mangerError").css('visibility', 'hidden');
		} else {
			$("#mangerError").html("请选择管理费");
			$("#mangerError").css('visibility', 'visible');
			return;
		}
		var loanRate = $("#loanRate").val() * 1;
		var exisk = $("#generalRate").val() * 1 - manger * 1 - loanRate;
		if (exisk < 0) {
			$("#mangerError").html("补偿金小于0,请修改管理费或综合费率");
			$("#mangerError").css('visibility', 'visible');
		} else {
			$("#error").html("");
			$("#error").css('visibility', 'hidden');
			$("#mangerError").html("");
			$("#mangerError").css('visibility', 'hidden');
			$("#bankError").html("");
			$("#bankError").css('visibility', 'hidden');
		}
		$("#expandRisk").html((exisk * 100).toFixed(4) + "%");
		$("#risk").val(exisk.toFixed(6));
	}
	//送审银行
	function onBankSelect() {
		var bankLoanName = $("#bankLoanName").val();
		var rate = 0;
		if (bankLoanName) {
			$("#bankError").html("");
			$("#bankError").css('visibility', 'hidden');
			if (bankLoanName == "CBC") {
				rate = 0.0775;
			} else if (bankLoanName == "BC") {
				rate = 0.065;
			} else if (bankLoanName == "GACZ") {
				rate = 0.065;
			} else if (bankLoanName == "CCBHN") {
				rate = 0.06003;
			} else if (bankLoanName == "QLB") {
				rate = 0.065;
			} else if (bankLoanName == "CIBJN") {
				rate = 0.065;
			} else if (bankLoanName == "JCB") {
				rate = 0.062;
			} else if (bankLoanName == "ZZB") {
				rate = 0.06525;
			} else if (bankLoanName == "SPDBGZ") {
				rate = 0.064815;
			} else if (bankLoanName == "SXB") {
				rate = 0.06;
			} else if (bankLoanName == "ZLB") {
				rate = 0.0609;
			} else if (bankLoanName == "SPDBJN") {
				rate = 0.06525;
			} else {
				rate = 0.08;
			}
			$("#loanrate").html((rate * 100).toFixed(4) + "%");
			var loanRate = $("#loanRate").val(rate.toFixed(6));
			var manger = $("#manger").val() * 1;
			var exisk = $("#generalRate").val() * 1 - manger - rate.toFixed(6)
					* 1;
			if (exisk < 0) {
				$("#bankError").html("补偿金小于0,请修改管理费或综合费率");
				$("#bankError").css('visibility', 'visible');
			} else {
				$("#error").html("");
				$("#error").css('visibility', 'hidden');
				$("#mangerError").html("");
				$("#mangerError").css('visibility', 'hidden');
				$("#bankError").html("");
				$("#bankError").css('visibility', 'hidden');
			}
			$("#expandRisk").html((exisk * 100).toFixed(4) + "%");
			$("#risk").val(exisk.toFixed(6));
		} else {
			$("#bankError").html("请选择送审银行");
			$("#bankError").css('visibility', 'visible');
			return;
		}
	}
       </@js>
       <@jsRender/>
	</form>
